﻿using System;

namespace KZ.Utilities
{
    [AttributeUsage(AttributeTargets.Property)]
    public class SearchAttribute : Attribute
    {
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class NotInsertUpdateAttribute : Attribute
    {
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class OutputAttribute : Attribute
    {
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class RequiredAttribute : Attribute
    {
        public string ErrorMessage { get; set; }
    }

    [AttributeUsage(AttributeTargets.Property)]
    public class StringLengthAttribute : Attribute
    {
        string _errorMessage;
        int _min, _max;

        public StringLengthAttribute(string errorMessage, int min, int max)
            : base()
        {
            _errorMessage = errorMessage;
            _min = min;
            _max = max;
        }

        public string ErrorMessage
        {
            get { return String.Format(_errorMessage, _min, _max); }
        }

        public int Min
        {
            get { return _min; }
        }

        public int Max
        {
            get { return _max; }
        }
    }
}
